const filter = {
    /* number  start */
    numberFil(val) {
        if (val) {
            return val;
        } else {
            return 0;
        }
    },
    /* number  end */

    /* 订单状态  start */
    // 1 未付款，2 已付款，3 未发货，4 已发货，5 交易成功，6 交易关闭,7 待评价
    statusFil: function(val) {
        if (val == 1) {
            return "未付款";
        } else if (val == 2) {
            return "已付款";
        } else if (val == 3) {
            return "未发货";
        } else if (val == 4) {
            return "已发货";
        } else if (val == 5) {
            return "交易成功";
        } else if (val == 6) {
            return "交易关闭";
        } else if (val == 7) {
            return "待评价";
        }
    },
    /* 订单状态  end */
    sellerHandleFil(val) {
        if (val == 1) {
            return "同意";
        } else if (val == 2) {
            return "不同意";
        } else if (val == 3) {
            return "";
        } else if (val == 4) {
            return "";
        } else if (val == 5) {
            return "";
        } else if (val == 6) {
            return "";
        } else {
            return "未处理";
        }
    },
    platformHandleFil(val) {
        if (val == 1) {
            return "同意";
        } else if (val == 2) {
            return "不同意";
        } else if (val == 3) {
            return "";
        } else if (val == 4) {
            return "";
        } else if (val == 5) {
            return "";
        } else if (val == 6) {
            return "";
        } else {
            return "未处理";
        }
    },
    applyTypeFil(val) {
        if (val == 1) {
            return "退货退款";
        } else if (val == 2) {
            return "";
        } else if (val == 3) {
            return "";
        } else if (val == 4) {
            return "";
        } else if (val == 5) {
            return "";
        } else if (val == 6) {
            return "";
        } else {
            return "仅退款";
        }
    },
    /* 年月日  start */
    dateYMDFil: function(val) {
        if (val) {
            let date = new Date(Number(val));
            let y, m, d, h, f;
            y = date.getFullYear();
            m = date.getMonth() + 1;
            m = m > 9 ? m : "0" + m;
            d = date.getDate();
            d = d > 9 ? d : "0" + d;
            h = date.getHours();
            h = h > 9 ? h : "0" + h;
            f = date.getMinutes();
            f = f > 9 ? f : "0" + f;
            return y + "-" + m + "-" + d
        } else {
            return "暂无";
        }
    },
    /* 年月日  end */
    /* 时分秒  start */
    dateHFSFil: function(val) {
        if (val) {
            let date = new Date(Number(val));
            let y, m, d, h, f, s;
            y = date.getFullYear();
            m = date.getMonth() + 1;
            m = m > 9 ? m : "0" + m;
            d = date.getDate();
            d = d > 9 ? d : "0" + d;
            h = date.getHours();
            h = h > 9 ? h : "0" + h;
            f = date.getMinutes();
            f = f > 9 ? f : "0" + f;
            s = date.getSeconds();
            s = s > 9 ? s : "0" + s;
            return h + ":" + f + ":" + s;
        } else {
            return "暂无";
        }
    },
    /* 时分秒  end */
    /* 字符串时间转化  start */
    dateStringFil: function(val, type) {
        if (isNaN(val) && !isNaN(Date.parse(val))) {
            if (val.indexOf(" ") > -1) {
                let dates = val.split(" ");
                if (type == "ymd") {
                    return dates[0];
                } else if (type == "hfs") {
                    return dates[1];
                }
            } else {
                return "暂无";
            }
        } else {
            return "暂无";
        }
    },
    /* 字符串时间转化  end */
    picPathFil: function(val) {
        if (val) {
            return `${_config.ImagePath}${val}`
        } else {
            return "暂无";
        }
    },

};
export default filter;